package com.tanlu.tcc.domain;

import com.tanlu.tcc.annotation.TransactionStatus;
import com.tanlu.tcc.util.TransactionXid;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


public class Transaction implements Serializable {

    private TransactionXid transactionId;

    private String serviceName;

    private Date createTime;

    private Date lastUpdateTime;

    private TransactionStatus status;

    private long outTime;

    private List<Participant> participants = new ArrayList<Participant>();

    public TransactionXid getTransactionId() {
        return transactionId;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public void setTransactionId(TransactionXid transactionId) {
        this.transactionId = transactionId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public TransactionStatus getStatus() {
        return status;
    }

    public void setStatus(TransactionStatus status) {
        this.status = status;
    }

    public long getOutTime() {
        return outTime;
    }

    public void setOutTime(long outTime) {
        this.outTime = outTime;
    }

    public void addParticipant(Participant participant) {
        participants.add(participant);
    }

    public List<Participant> getParticipants() {
        return participants;
    }
}
